package com.dopplr.api
{
    /** represents a Dopplr user
     *  @see Model#getTravellerFromXML
     */    
    public class Traveller
    {
        /** the end of a sentence describing the user
         *  e.g. "is at home in London" */
        public var status:String;
        /** user's full name, e.g. Matt Biddulph */
        public var name:String;
        /** hash of email address for matching against other services
         *  e.g. 83e84acac52bed22ff8546a4c3ccb1464593695c */
        public var sha1email:String;
        /** for generating an icon url, e.g. 361ff28715577fc9d934deef590015be */
        public var iconId:String;
        /** short (unique) name, as seen in Dopplr URLs, e.g. mattb */
        public var nick:String;
        /** link to user's profile, e.g. http://www.dopplr.com/traveller/mattb */
        public var url:String;
        /** whether the user is travelling today, true/false */
        public var travelToday:Boolean;
        
        /** where the user lives
         *  @see Model#getCityFromXML */
        public var homeCity:City;
        /** where the user is today
         *  @see Model#getCityFromXML */
        public var currentCity:City;

        /** set by api.loadFellowsTravellingToday if the user is on a trip
         *  @see API#loadFellowsTravellingToday */
        public var currentTrip:Trip;
        
        /** all the user's trips, if they've been downloaded
         *  @see API#loadTripsForFellows 
         *  @see API#loadUser */
        public var trips:Array = [];
        
        public function get iconURL():String
        {
            return "http://assets" + int(Math.random()*4).toString() + ".dopplr.com/traveller/" + iconId + "/icon.png";            
        }
        
        public function get fullIconURL():String
        {
            return "http://assets" + int(Math.random()*4).toString() + ".dopplr.com/traveller/" + iconId + "/full_icon.png";
        }
    }
}